/*!
* 
* Copyright (c) 2009 by yuqiang @ vcedu
* 
* Description:
*		This file contains the audio interface which would be used outside the lib
*
* ChangeLog:
*		$Date$	$Rev$	$Author$
* 
*/	

#ifndef _IAUDIO_H_
#define _IAUDIO_H_

#include "dllheader.h"


extern "C" {

	/**
	*  \brief AudioParam define the parameters that needs by establish a audio session.
	*
	*		  You should init this structure by calling librtp_audio_param_init(pParam).
	*		  After initialization, you can set the parameter that you want.
	*/
	struct AudioParam{
		bool highPriority;
		unsigned short portbase;
		bool acceptOwnPackets;
		SpeexBandWidth speexMode;
		int inputMultiplier, outputMultiplier;
		CompressionType compType;
		unsigned char speexOutgoingPT, speexIncomingPT;
	};

	/**
	*   \brief init the Audio Parameters
	*
	*   \param[in] pParam the audio parameter
	*   
	*/
	LIBRTP_API void librtp_audio_param_init(struct AudioParam *pParam);

	/**
	*  \brief init the audio session
	*  
	*  \param[in] pParam Audio Parameter used to init audio session
	*
	*  \return boolean value to indicate whether this init successful
	*/
	LIBRTP_API bool librtp_audio_init(struct AudioParam *pParam);

	/**
	*   \brief close the audio session
	*
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_audio_close();

	/**
	*   \brief add a destination, so user can receive our audio
	*   
	*    \param[in] ipAddr[4] ip Address in unsigned char format such as {192,168,0,1}
	*    \param[in] port destination listening port
	*
	*    \return boolean value
	*/
	LIBRTP_API bool librtp_audio_addDestination(unsigned char ipAddr[4],unsigned int port);

	/**
	*   \brief delete a destination, so user can not receive our audio
	*   
	*    \param[in] ipAddr[4] ip Address in unsigned char format such as {192,168,0,1}
	*    \param[in] port destination listening port
	*
	*    \return boolean value
	*/
	LIBRTP_API bool librtp_audio_deleteDestination(unsigned char ipAddr[4],unsigned int port);

	/**
	*   \brief clear all destinations
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_audio_clearDestinations();

	/**
	*   \brief set the receive mode
	*   
	*	\param mode the receivde mode
	*
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_audio_setReceiveMode(ReceiveMode mode);

	/**
	*   \brief add a user to ignore list, we would ignore all the packets sent by this user
	*   
	*    \param[in] ipAddr[4] ip Address in unsigned char format such as {192,168,0,1}
	*    \param[in] port destination listening port
	*
	*    \return boolean value
	*/
	LIBRTP_API bool librtp_audio_addToIgnoreList(unsigned char ipAddr[4],unsigned int port);

	/**
	*   \brief delete a user from ignore list
	*   
	*    \param[in] ipAddr[4] ip Address in unsigned char format such as {192,168,0,1}
	*    \param[in] port destination listening port
	*
	*    \return boolean value
	*/
	LIBRTP_API bool librtp_audio_deleteFromIgnoreList(unsigned char ipAddr[4],unsigned int port);

	/**
	*   \brief clear ignore list
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_audio_clearIgnoreList();

	/**
	*   \brief add a user to Accept list, we would accept all the packets sent by this user
	*   
	*    \param[in] ipAddr[4] ip Address in unsigned char format such as {192,168,0,1}
	*    \param[in] port destination listening port
	*
	*    \return boolean value
	*/
	LIBRTP_API bool librtp_audio_addToAcceptList(unsigned char ipAddr[4],unsigned int port);

	/**
	*   \brief delete a user from Accept list
	*   
	*    \param[in] ipAddr[4] ip Address in unsigned char format such as {192,168,0,1}
	*    \param[in] port destination listening port
	*
	*    \return boolean value
	*/
	LIBRTP_API bool librtp_audio_deleteFromAcceptList(unsigned char ipAddr[4],unsigned int port);

	/**
	*   \brief clear Accept list
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_audio_clearAcceptList();

	/**
	*   \brief start send chain, we would send our audio to destinations
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_audio_startSendChain();

	/**
	*   \brief stop send chain, we would stop sending our audio to destinations
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_audio_stopSendChain();

	/**
	*   \brief start receive chain, we would start to receive all incoming packets
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_audio_startReceiveChain();

	/**
	*   \brief stop receive chain, we would stop receiving all incoming packets
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_audio_stopReceiveChain();

	/**
	*   \brief start audio session
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_audio_startSession();

	/**
	*   \brief stop audio session
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_audio_stopSession();

	/**
	*   \brief check whether audio session has been initialized
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_audio_isInit();

	/**
	*   \brief check whether audio session is running
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_audio_isSessionRunning();

	/**
	*   \brief check whether audio session is sending
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_audio_isSendRunning();

	/**
	*   \brief check whether audio session is receiving
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_audio_isReceiveRunning();

};



#endif //_IAUDIO_H_